﻿
@{
    ViewBag.Title = "Add";
    Layout = null;
}
@using Shop.Entity;
@model TManager

<div class="modal-dialog">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <h4 class="modal-title" id="headerTitle">@(Model.Guid == Guid.Empty ? "添加" : "编辑")操作员</h4>
        </div>
        <div class="modal-body">
            @using (Html.BeginForm("add", "admin", FormMethod.Post, new { id = "add", @class = "form-horizontal" }))
            {
                @Html.HiddenFor(c => c.Guid)
                @Html.HiddenFor(c => c.AddTime)
                @Html.HiddenFor(c => c.LastLoginTime)

                @Html.HiddenFor(c => c.OperatorGuid)
                @Html.HiddenFor(c => c.BusinessGuid)
                @Html.HiddenFor(c => c.ChainStoreGuid)
                <div class="row">
                    <div class="col-md-10">
                        <div class="form-group">
                            <label for="inputEmail3" class="col-sm-3 control-label">*姓&nbsp;&nbsp;&nbsp;&nbsp;名:</label>
                            <div class="col-sm-7">
                                @Html.TextBoxFor(c => c.Name, new { @class = "form-control input-sm", @placeholder = "请输入真实姓名", @datatype = "s2-5", @nullmsg = "请输入操作员姓名!", @errormsg = "姓名在2至5个字符！", @sucmsg = " " })
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-10">
                        <div class="form-group">
                            <label for="inputEmail3" class="col-sm-3 control-label">*权&nbsp;限&nbsp;组&nbsp;:</label>
                            <div class="col-sm-7">
                                @Html.DropDownListFor(c => c.ManagerRoleGuid, ViewData["RoleList"] as List<SelectListItem>, "-请选择-", new { @class = "form-control input-sm", @datatype = "*", @nullmsg = "请选择所属角色!", @sucmsg = " " })
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-10">
                        <div class="form-group">
                            <label for="inputEmail3" class="col-sm-3 control-label">*账&nbsp;&nbsp;&nbsp;&nbsp;号:</label>
                            <div class="col-sm-7">
                                @Html.TextBoxFor(c => c.LoginName, new { @class = "form-control input-sm", @placeholder = "请输入账号", @datatype = "s5-20", @nullmsg = "请输入登录账号!", @errormsg = "账号至少5个字符，最多20个字符！", @sucmsg = " " })
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-10">
                        <div class="form-group">
                            <label for="inputEmail3" class="col-sm-3 control-label">*密&nbsp;&nbsp;&nbsp;&nbsp;码:</label>
                            <div class="col-sm-7">
                                @Html.PasswordFor(c => c.LoginPwd, new { @class = "form-control input-sm", @placeholder = "请输入密码", @datatype = " *6-20", @nullmsg = "请输入密码!", @errormsg = "密码必须在6至20个字符之间！", @sucmsg = " " })

                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-10">
                        <div class="form-group">
                            <label for="inputEmail3" class="col-sm-3 control-label">*确认密码:</label>
                            <div class="col-sm-7">
                                <input type="password" id="password2" class="form-control input-sm" placeholder="请再次输入密码" recheck="LoginPwd" nullmsg="请输入确认密码!" errormsg="两次输入密码不一致!" sucmsg=" " />
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-10">
                        <div class="form-group">
                            <label for="inputEmail3" class="col-sm-3 control-label">联系方式:</label>
                            <div class="col-sm-7">
                                @Html.TextBoxFor(c => c.Phone, new { @class = "form-control input-sm", @placeholder = "手机号 / 电话 /" })
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-10">
                        <div class="form-group">
                            <label for="inputEmail3" class="col-sm-3 control-label">电子邮件:</label>
                            <div class="col-sm-7">
                                @Html.TextBoxFor(c => c.Email, new { @class = "form-control input-sm", @placeholder = "请输入邮箱" })
                            </div>
                        </div>
                    </div>
                </div>
     
                <div class="row">
                    <div class="col-md-10">
                        <div class="form-group">
                            <label for="inputEmail3" class="col-sm-3 control-label">备注信息:</label>
                            <div class="col-sm-7">
                                @Html.TextBoxFor(c => c.Remark, new { @class = "form-control input-sm", @placeholder = "备注" })
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="form-group">
                        <label for="message-text" class="col-sm-3 control-label"></label>
                        <div class="col-sm-6" id="tip">
                            &nbsp;
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-primary" value="保存">保存</button>
                    <button type="button" id="" class="btn btn-default" data-dismiss="modal">取消</button>
                </div>
            }
        </div>

    </div>
</div>
<script type="text/javascript">
    $('#Add').on('hidden.bs.modal', function (e)
    {
        layer.closeAll('tips'); //关闭所有的tips层
    })
    $(function ()
    {
        $("#add").Validform({
            showAllError: true,
            ajaxPost: true,
            beforeSubmit: function (curform)
            {
                layer.msg('正在执行操作...', { icon: 16 });
                return true;
            },
            callback: function (data)
            {
                if (data.succ)
                {
                    $("#formSearch").submit();
                }
            },
            tiptype: function (msg, o)
            {
                if (msg.trim() != "" && o.type != 1)
                {
                    layer.tips(msg, '#' + $(o.obj).attr("id"), { tipsMore: true });
                }
            }
        });
    })
</script>
